<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <script src="./js/axios.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        a { text-decoration: none; }

        .myheader {
            width: 100%;
            height: 35px;
            background-color: #e54847;
            position: fixed;
            text-align: center;
            padding-top: 20px;
            color: #ffff;
            top: 0;
            left: 0;
            right: 0;

        }

        .con {
            width: 100%;
            margin-top: 150px;
            margin-bottom: 50px;
        }

        .con div span {
            height: 100px;
            background: #f5f5f5;
            margin-top: 5px;
            margin-bottom: 5px;
            /* display: inline-block;  */
        }

        .myfooter {
            width: 100%;
            height: 60px;
            bottom: 0;
            left: 0;
            position: fixed;
            bottom: 0;
            background: #fff;
            border-top: .5px solid #d8d8d8;
            /* display: flex;
            justify-content: space-around;
            align-items: center; */
        }

        .myfooter img{
            width: 25px;
            height: 25px;
            margin-left: 20px;
            margin-top: 4px;
            display: flex;
            justify-content: space-around;
            align-items: center;
        }


        .myfooter a{
            margin-left: 7px;
            margin-top: 22px;
            font-size: 12px;
            color: #f03d37;
        }
    </style>
</head>


<body>
    <div id="app">
        <myheader></myheader>
        <mycon :list="lista"></mycon>
        <myfooter></myfooter>
    </div>
    <script>
        /*孙子组件*/
        var myitem = {
            props: ["item"],
            template: `
            <li >
                <img :src="item.img" />
                {{item.showInfo}}
            </li>
            `
        }


        /*********子组件*****************/
        /*子组件*/
        var myheader = {
            template: `<div class="myheader">猫眼电影
                </div>`
        }
        var mycon = {
            props: ['lista'],
            mounted() {
                //console.log(this.list);
                this.$nextTick(() => {
                    console.log(this.lista);
                })
            },
            components: { myitem },
            template: `<div class="con">
                <ul>
                    <myitem v-for="item in lista" :key="item.id" :item="item"></myitem>
                    <li v-for="item in list" :key="item.productId">
                        <div>
                            <img :src="item.proPicUrl" />
                        </div>
                    </li>
                </ul>
                </div>`
        }
        var myfooter = {
            template: `<div class="myfooter">
                    <div>
                        <span><img src="./2.png" alt=""></span>
                        <span><a href="">电影/影院</a></span>  
                        <span><img src="./2.png" alt=""></span>
                        <span><a href="">电影/影院</a></span>
                        <span><img src="./2.png" alt=""></span>
                        <span><a href="">电影/影院</a></span>
                        <span><img src="./2.png" alt=""></span>
                        <span><a href="">电影/影院</a></span>
                        <span><img src="./2.png" alt=""></span>
                        <span><a href="">电影/影院</a></span>  
                    </div>
                </div>`
        }
        /**********子组件*************/
        /*********根************/
        var app = new Vue({
            el: "#app",
            data: {
                msg: "hello",
                lista: []
            },
            mounted() {
                axios.get("lista.json").then(res => {
                    console.log(res);
                    this.lista = res.data.movieList;
                    this.lista.forEach(myitem => {
                        myitem.img = myitem.img.replace("w.h", "64.90");
                    })
                })
            },
            components: {
                myheader, mycon, myfooter
            }
        })
    </script>
</body>

</html>